#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main()
{
    double a, b, r;
    int k;
    scanf("%lf %lf", &a, &b);
    k = a / b;
    r = a - k * b;

    printf("%g\n", r);

    return 0;
}